<?php

/**
 * Создание путей сайта
 *
 */
function create_path($array, $use_current = true, $glue = ' &gt; ') {
   $obj =& get_instance();
   $obj->load->language('path');
   $new_array = array();
   foreach ($array as $i => $chunk) {
      if (is_array($chunk) && isset($chunk['link']) && isset($chunk['title'])) {
         $out = '';
         if ($i < count($array) - 1) {
            $out = str_replace(array('{%link%}', '{%title%}'), array($chunk['link'], $chunk['title']), $obj->lang->line('path_link_element'));
         } else {
            if ($use_current) {
               $out = str_replace('{%title%}', $chunk['title'], $obj->lang->line('path_current_element'));
            } else {
               $out = str_replace(array('{%link%}', '{%title%}'), array($chunk['link'], $chunk['title']), $obj->lang->line('path_link_element'));
            }
         }
         if (!empty($out)) {
            array_push($new_array, $out);
         }
      }
   }
   return implode($glue, $new_array);
} // end create_path
